<template>
  <div>
    <son :id="num" ref="refSon" />
    <button @click="changeID">修改id</button>
  </div>
</template>
<script>
import Son from './son'
export default ({
  components: { Son },
  data() {
    return {
      num: 1
    }
  },
  methods: {
    changeID() {
      this.num = 2
      this.$nextTick(() => {
        this.$refs.refSon.doSomething()
        // console.log(this.$refs.refSon.id) //
      })
    }
  }
})
</script>
